//
//  PersonalInformationTableViewCell.m
//  chongwu
//
//  Created by 隼目 on 2021/9/23.
//

#import "PersonalInformationTableViewCell.h"

@implementation PersonalInformationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)creatView{
    self.backgroundColor=[UIColor whiteColor];
    
    UIView *topView=[UIView new];
    [self.contentView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(0);
        make.height.mas_equalTo(126*_mainHeight);
    }];
    topView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectSelectPicture:)];
    [topView addGestureRecognizer:tapGesture];
    
    
    UIView *xianView=[UIView new];
    [self.contentView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(17*_mainWidth);
        make.right.mas_equalTo(-17*_mainWidth);
        make.height.mas_equalTo(1.5*_mainHeight);
        make.top.mas_equalTo(topView.mas_bottom);
    }];
    xianView.backgroundColor=rgba(232,232,232,1);
    
    UIImageView *userImage=[UIImageView new];
    [topView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(51*_mainWidth);
        make.width.height.mas_equalTo(90*_mainWidth);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=45*_mainWidth;
    if (self.userImage==nil) {
        [userImage sd_setImageWithURL:nil placeholderImage:[UIImage imageNamed:@"touxiang"]];
    }else{
        userImage.image=self.userImage;
    }
    
    UILabel *userName=[UILabel new];
    [topView addSubview:userName];
    [userName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(30*_mainWidth);
        make.centerY.mas_equalTo(0);
    }];
    userName.text=@"全打下";
    userName.textColor=rgba(44,46,52,1);
    userName.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    
    UIImageView *moerImage=[UIImageView new];
    [topView addSubview:moerImage];
    [moerImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-53*_mainWidth);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(_mainWidth*11);
        make.height.mas_equalTo(24*_mainHeight);
    }];
    moerImage.image=[UIImage imageNamed:@"gengduo"];
    
    
    UIView *topView2=[UIView new];
    [self.contentView addSubview:topView2];
    [topView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView.mas_bottom);
        make.height.mas_equalTo(121*_mainHeight);
    }];
    
    UIView *xianView2=[UIView new];
    [self.contentView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(17*_mainWidth);
        make.right.mas_equalTo(-17*_mainWidth);
        make.height.mas_equalTo(1.5*_mainHeight);
        make.top.mas_equalTo(topView2.mas_bottom);
    }];
    xianView2.backgroundColor=rgba(232,232,232,1);
    
    UILabel *label=[UILabel new];
    [topView2 addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(userImage);
        make.centerY.mas_equalTo(0);
    }];
    label.text=@"手机号";
    label.textColor=rgba(47,47,47,1);
    label.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];
    
    UITextField *text=[UITextField new];
    [topView2 addSubview:text];
    [text mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(topView.mas_centerX);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-50*_mainWidth);
        make.height.mas_equalTo(80*_mainHeight);
    }];
    text.text=@"136****3326";
    text.textColor=rgba(45,45,45,1);
    text.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];
    text.textAlignment=NSTextAlignmentRight;
    text.enabled=NO;
    
    UIView *topView3=[UIView new];
    [self.contentView addSubview:topView3];
    [topView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView2.mas_bottom);
        make.height.mas_equalTo(121*_mainHeight);
    }];
    topView3.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(selectCustomerType:)];
    [topView3 addGestureRecognizer:tapGesture2];
    
    UIView *xianView3=[UIView new];
    [self.contentView addSubview:xianView3];
    [xianView3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(17*_mainWidth);
        make.right.mas_equalTo(-17*_mainWidth);
        make.height.mas_equalTo(1.5*_mainHeight);
        make.top.mas_equalTo(topView3.mas_bottom);
    }];
    xianView3.backgroundColor=rgba(232,232,232,1);
    
    UILabel *label2=[UILabel new];
    [topView3 addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(userImage);
        make.centerY.mas_equalTo(0);
    }];
    label2.text=@"用户类型";
    label2.textColor=rgba(47,47,47,1);
    label2.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];
    
    UITextField *text2=[UITextField new];
    [topView3 addSubview:text2];
    [text2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(text);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-50*_mainWidth);
        make.height.mas_equalTo(80*_mainHeight);
    }];
    text2.text=@"犬舍";
    text2.textColor=rgba(45,45,45,1);
    text2.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];
    text2.textAlignment=NSTextAlignmentRight;
    text2.enabled=NO;

    UIView *leftView=[UIView new];
    [leftView setFrame:CGRectMake(0, 0, 40*_mainWidth, 60*_mainHeight)];
    UIImageView *phoneImageView=[UIImageView new];
    [leftView addSubview:phoneImageView];
    [phoneImageView setFrame:CGRectMake(40*_mainWidth-11*_mainWidth, (60*_mainHeight-24*_mainWidth)/2, 11*_mainWidth, 24*_mainWidth)];
    phoneImageView.image=[UIImage imageNamed:@"gengduo"];
    text2.rightView = leftView;
    text2.rightViewMode =UITextFieldViewModeAlways;
    
    
    UIView *topView4=[UIView new];
    [self.contentView addSubview:topView4];
    [topView4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView3.mas_bottom);
        make.height.mas_equalTo(121*_mainHeight);
    }];

    UIView *xianView4=[UIView new];
    [self.contentView addSubview:xianView4];
    [xianView4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(17*_mainWidth);
        make.right.mas_equalTo(-17*_mainWidth);
        make.height.mas_equalTo(1.5*_mainHeight);
        make.top.mas_equalTo(topView4.mas_bottom);
    }];
    xianView4.backgroundColor=rgba(232,232,232,1);

    UILabel *label3=[UILabel new];
    [topView4 addSubview:label3];
    [label3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(userImage);
        make.centerY.mas_equalTo(0);
    }];
    label3.text=@"用户等级";
    label3.textColor=rgba(47,47,47,1);
    label3.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];

    UITextField *text3=[UITextField new];
    [topView4 addSubview:text3];
    [text3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(text);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-50*_mainWidth);
        make.height.mas_equalTo(80*_mainHeight);
    }];
    text3.text=@"普通会员";
    text3.textColor=rgba(45,45,45,1);
    text3.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];
    text3.textAlignment=NSTextAlignmentRight;
    text3.enabled=NO;

    UIView *leftView2=[UIView new];
    [leftView2 setFrame:CGRectMake(0, 0, 40*_mainWidth, 60*_mainHeight)];
    UIImageView *phoneImageView2=[UIImageView new];
    [leftView2 addSubview:phoneImageView2];
    [phoneImageView2 setFrame:CGRectMake(40*_mainWidth-11*_mainWidth, (60*_mainHeight-24*_mainWidth)/2, 11*_mainWidth, 24*_mainWidth)];
    phoneImageView2.image=[UIImage imageNamed:@"gengduo"];
    text3.rightView = leftView2;
    text3.rightViewMode =UITextFieldViewModeAlways;

    UIView *topView5=[UIView new];
    [self.contentView addSubview:topView5];
    [topView5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(xianView4.mas_bottom);
        make.height.mas_equalTo(121*_mainHeight);
    }];
    topView5.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture5 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushToController:)];
    [topView5 addGestureRecognizer:tapGesture5];
//
    
    UILabel *label4=[UILabel new];
    [topView5 addSubview:label4];
    [label4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(userImage);
        make.centerY.mas_equalTo(0);
    }];
    label4.text=@"揽件员认证";
    label4.textColor=rgba(47,47,47,1);
    label4.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];

    UITextField *text4=[UITextField new];
    [topView5 addSubview:text4];
    [text4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(text);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-50*_mainWidth);
        make.height.mas_equalTo(80*_mainHeight);
    }];
    text4.text=@"待申请";
    text4.textColor=rgba(218,73,73,1);
    text4.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(32)];
    text4.textAlignment=NSTextAlignmentRight;
    text4.enabled=NO;

    UIView *leftView3=[UIView new];
    [leftView3 setFrame:CGRectMake(0, 0, 40*_mainWidth, 60*_mainHeight)];
    UIImageView *phoneImageView3=[UIImageView new];
    [leftView3 addSubview:phoneImageView3];
    [phoneImageView3 setFrame:CGRectMake(40*_mainWidth-11*_mainWidth, (60*_mainHeight-24*_mainWidth)/2, 11*_mainWidth, 24*_mainWidth)];
    phoneImageView3.image=[UIImage imageNamed:@"gengduo"];
    text4.rightView = leftView3;
    text4.rightViewMode =UITextFieldViewModeAlways;
}
-(void)creatBtnView{
    self.backgroundColor=[UIColor clearColor];
    
    UIButton *signInBtn=[UIButton new];
    [self.contentView addSubview:signInBtn];
    [signInBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(39*_mainWidth);
        make.width.mas_equalTo(_mainW-78*_mainWidth);
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(_mainHeight*87);
    }];
    [signInBtn setTitle:@"确定" forState:0];
    [signInBtn setTitleColor:[UIColor whiteColor] forState:0];
    signInBtn.titleLabel.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    
    [signInBtn layoutIfNeeded];
    signInBtn.layer.masksToBounds=YES;
    signInBtn.layer.cornerRadius=87*_mainHeight/2;
    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
    gradientLayer.frame = signInBtn.bounds;
    //将CAGradientlayer对象添加在我们要设置背景色的视图的layer层
    [signInBtn.layer insertSublayer:gradientLayer atIndex:0];
    //设置渐变区域的起始和终止位置（范围为0-1）
    gradientLayer.startPoint = CGPointMake(0, 1);
    gradientLayer.endPoint = CGPointMake(1, 1);
    gradientLayer.colors = @[(__bridge id)rgba(255,159,0,1).CGColor,
                             (__bridge id)rgba(255,116,0,1).CGColor ,
                             (__bridge id)rgba(255,102,0,1).CGColor];
    //设置颜色分割点（范围：0-1）
    gradientLayer.locations = @[@(0),@(0.5), @(1.0f)];
    signInBtn.layer.shadowColor = rgba(196,50,0,0.36).CGColor;
    signInBtn.layer.shadowOffset = CGSizeMake(0,0);
    signInBtn.layer.shadowOpacity = 1;
    signInBtn.layer.shadowRadius = 4;
}
-(void)selectSelectPicture:(UITapGestureRecognizer *)tap{
    if (self.delegate!=nil) {
        [self.delegate selectSelectPicture];
    }
}
-(void)selectCustomerType:(UITapGestureRecognizer *)tap{
    if (self.delegate!=nil) {
        [self.delegate selectCustomerType];
    }
}
-(void)pushToController:(UITapGestureRecognizer *)tap{
    if (self.delegate!=nil) {
        [self.delegate pushToController];
    }
}

@end
